﻿using System;
using System.Collections.Generic;
using System.Data;

namespace Tms.BLL
{
    public class record_body
    {
        private readonly DAL.record_body dal = new DAL.record_body();
        
        //是否存在该记录
        public bool Exists(int id)
        {
            return dal.Exists(id);
        }
        public bool Exists(string body_name)
        {
            return dal.Exists(body_name);
        }

        //增加一条数据
        public int Add(Model.record_body model)
        {
            return dal.Add(model);
        }

        //更新一条数据
        public bool Update(Model.record_body model)
        {
            return dal.Update(model);
        }

        //删除一条数据
        public bool Delete(int id)
        {
            return dal.Delete(id);
        }

        //获取一个实体对象
        public Model.record_body GetModel(int id)
        {
            return dal.GetModel(id);
        }

        //获取查询分页数据
        public DataSet GetList(int pageSize, int pageIndex, string strWhere, string strOrder, out int recordCount)
        {
            return dal.GetList(pageSize, pageIndex, strWhere, strOrder, out recordCount);
        }

        //为了下拉
        public List<string> GetBodyNameList()
        {
            List<string> names = new List<string>();

            DataSet ds = dal.GetBodyNameList();

            foreach (DataRow r in ds.Tables[0].Rows)
            {
                names.Add(Convert.ToString(r[0]));
            }

            return names;
        }

        //获取图片名称
        public string GetPicName(string body_name)
        {
            return dal.GetPicName(body_name);
        }

        //通用
        public DataSet GetList(string strWhere, string strOrder)
        {
            return dal.GetList(strWhere, strOrder);
        }

        //通用
        public DataSet GetList(string strSQL)
        {
            return dal.GetList(strSQL);
        }


    }
}
